package com.jpc.musicdelightapplication.ui.square

import androidx.lifecycle.MutableLiveData
import com.jpc.lib_base.base.BaseViewModel
import com.jpc.lib_base.ext.handleRequest
import com.jpc.lib_base.ext.launch
import com.jpc.lib_base.utils.LogUtil
import com.jpc.musicdelightapplication.data.DataRepository
import com.jpc.musicdelightapplication.data.bean.PlaylistData

class SquareChildViewModel : BaseViewModel() {
    companion object {
        const val LIMIT = 21
    }

    val playlistLiveData = MutableLiveData<List<PlaylistData>?>()
    override fun start() {
    }

    fun fetchPlaylist(cat: String, offset: Int) {
        launch({
            handleRequest(DataRepository.getPlaylistList(cat, LIMIT, offset),
                { playlistLiveData.value = it.data })
        })
    }
}